import { S } from '../../s';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSSpan } from './ipsspan';
import { PSCodeListEditorImpl } from './pscode-list-editor-impl';

export class PSSpanImpl extends PSCodeListEditorImpl implements IPSSpan {
  get caption(): string {
    return this.M.caption;
  }

  get hAlign(): 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFY' {
    return this.M.hAlign || 'LEFT';
  }

  protected linkpsappview: IPSAppView;
  getLinkPSAppView(): IPSAppView | null {
    return (
      this.linkpsappview ||
      (this.linkpsappview = this.fillObjectModel(
        S._1e,
        this.M.getLinkPSAppView,
        S._2ee,
      ) as IPSAppView)
    );
  }

  get precision(): number {
    return this.M.precision;
  }

  get renderMode():
    | 'TEXT'
    | 'HEADING1'
    | 'HEADING2'
    | 'HEADING3'
    | 'HEADING4'
    | 'HEADING5'
    | 'HEADING6'
    | 'PARAGRAPH' {
    return this.M.renderMode;
  }

  get vAlign(): 'TOP' | 'MIDDLE' | 'BOTTOM' {
    return this.M.vAlign || 'MIDDLE';
  }

  get wrapMode(): 'WRAP' | 'NOWRAP' {
    return this.M.wrapMode || 'NOWRAP';
  }

  get editable(): boolean {
    return this.M.editable != null ? this.M.editable : false;
  }

  get enableLinkView(): boolean {
    return this.M.enableLinkView;
  }
  get cls(): string {
    return 'PSSpanImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3a4 || cls == S._13c) return true;
    return super.instanceof(cls);
  }
}
